package com.payment.mapper;

import com.payment.entity.common.OrderPaymentManager;
import com.payment.entity.common.OrderRefPackageManager;
import com.payment.entity.common.UserboundPaymentOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrderPaymentManagerMapper {

    public void storageOrderPayment(OrderPaymentManager userOrder);

    public void updateOrderIdByRequestOrderIdAndDeviceId(OrderPaymentManager user);

    public void updateIsOpenAndNotify(OrderPaymentManager userOrder);

    public List<OrderPaymentManager> getListToOpen();

    public int findOrderIdByNotify(String orderId);

    public void updateIsNotify(OrderPaymentManager paymentOrder);

    public List<OrderPaymentManager> getOrderResultsList(@Param("orderId") String orderId, @Param("deviceId") String deviceId);

    public void updateIsChannelNotity(OrderPaymentManager paymentOrder);

    public List<OrderPaymentManager> getChannelResultList();

    public void insertRefPackage(OrderRefPackageManager ref);

    public void UpdatePaypalNotify(UserboundPaymentOrder order);

    public int findDataByRequestOrderId(@Param("requestOrderId") String requestOrderId, @Param("deviceId") String deviceId, @Param("orderPeriod") String orderPeriod, @Param("partnerCode") String partnerCode, @Param("packageCode") String packageCode);

    public UserboundPaymentOrder queryPaymentOrderByOrderId(@Param("orderId") String orderId, @Param("amount") String amount);

    public void updateIsNotifyOrderT(OrderPaymentManager paymentManager);

    public void UpdatePaypalNotifyById(UserboundPaymentOrder order);

    /**
     * 查询数据库里面有没有这条回调数据
     *
     * @param orderNo
     * @return
     */
    Integer findOrderCodeByNotify(@Param("orderNo") String orderNo);

    /**
     * 回调数据更新数据表
     *
     * @param paymentOrder
     * @return
     */
    Integer updatePayRstById(OrderPaymentManager paymentOrder);

    /**
     * 根据上报的orderNo和requestOrderId查询订单记录
     *
     * @param orderNo
     * @param requestOrderId
     * @return
     */
    OrderPaymentManager queryOrderByOrderId(@Param("orderNo") String orderNo,
                                            @Param("requestOrderId") String requestOrderId);

    /**
     * 去数据库更新orderId等字段
     *
     * @param order
     * @return
     */
    Integer updateOrderId(OrderPaymentManager order);

    /**
     * payPal-webHook 回调去入库：user_order_payment_manager_t
     *
     * @param paymentOrder
     * @return
     */
    Integer updatePayRst(OrderPaymentManager paymentOrder);

    /**
     * 根据orderNo查询订单对象
     *
     * @param orderNo
     * @return
     */
    OrderPaymentManager queryOrderByOrderNo(@Param("orderNo") String orderNo);
}
